<?php
/**
 * Created by PhpStorm.
 * User: yuyiwen
 * Date: 2018/9/13
 * Time: 下午2:54
 */

namespace app\admin\model;


class RolePermission
{
    public function getPermissions ($role_ids)
    {
        $permission = db('rolePermission')->where(['role_id'=>['in' , $role_ids]])->select();
        $permission_list = [];
        foreach ($permission as $key => $value)
        {
            if (!in_array($value['permission_id'] , $permission_list))
            {
                $permission_list[] = $value['permission_id'];
            }
        }
        $permission_list = implode(',' , $permission_list);
        return $permission_list;
    }
}